package com.shen.GOF.single;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;

//enum是一个类，表示该类型的对象是有限的几个
public enum EnumSingle {
INSTANCE;
public EnumSingle getInstance(){
    return INSTANCE;
}
}

class Test{
    public static void main(String[] args) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException {
        Constructor<EnumSingle> constructor = EnumSingle.class.getDeclaredConstructor(String.class,int.class);
        constructor.setAccessible(true);
        EnumSingle instance = constructor.newInstance();
        System.out.println(instance);
    }
}